<template>
  <div class="news_content  pdlr-17">
    <my-swiper v-if="showSwiper" :imageData="imageData"></my-swiper>
    <div class="news_list">
      <van-list :loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
        <news-item v-for="item in data" :data="item" :src="src"></news-item>
      </van-list>
    </div>
  </div>
</template>

<script setup lang="ts">
import { PropType, ref } from "vue";
import mySwiper from "../mySwiper/mySwiper.vue";
import newsItem from "../newsItem/newsItem.vue"
import { INewsRes } from "@/pages/importantNews/type";
const props = defineProps({
  src: {
    type: String,
    default: ''
  },
  data: {
    // 他是自定义类型
    type: Object as PropType<INewsRes[]>,
    default: () => ({})
  },
  imageData: {
    // 他是自定义类型
    type: Object as PropType<Array<INewsRes & {
      newsImg: string
    }>>,
    default: () => []
  },
  loading: {
    type: Boolean,
    default: false
  },
  finished: {
    type: Boolean,
    default: false
  },
  showSwiper: {
    type: Boolean,
    default: true
  }

})
const emit = defineEmits(["load"]);


const onLoad = () => {
  emit("load");
};

</script>

<style scoped lang="less">
.my-swipe {
  width: 100%;


}
</style>
<style lang="less">
.news_content {
  overflow: hidden;

  .van-swipe-item {
    width: 100%;
    margin-top: 20px;
  }
}
</style>
